package modele;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.List;
import java.util.Scanner;

import log.logger;

import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

public class Employes {
		public List<Employe> employes;
		public long num;

		public static Employes Factory(){
			String js="";
			System.out.println(System.getProperty("user.dir"));
		    File file = new File("/Users/richard/Documents/perso/planningserver/tools-eclipse-conf/src/dataExemple/employes.json");
		    try {
				Scanner sc = new Scanner(file);
				//js = sc.toString();
				while (sc.hasNext()){
					js = js + sc.nextLine();
				}
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		    
		   Employes data = new Gson().fromJson(js, Employes.class);

          /* JsonParser jsonParser = new JsonParser();
           JsonObject jo = (JsonObject)jsonParser.parse(js);
           JsonArray jsonArr = jo.getAsJsonArray("employes");
           */
		   
		   logger.Infologg("[get liste employes]"+data.num + "  " + data.employes + "\n\n");
		    return data;
			
		}
	 	public Employes(){
	 		

	 	}
		public List<Employe> getEmployes() {
			return employes;
		}
		public void setEmployes(List<Employe> employes) {
			this.employes = employes;
		}
}
